/**
 * ObserverTest.java
 *
 * @author: ZhuJiahui
 * @date: 2018/8/26 15:32
 */
package com.zhujiahui.pattern.design.observer;

/**
 * @description:
 * @author: ZhuJiahui
 * @version: 1.0
 */
public class ObserverTest {
    public static void main(String[] args) {

        WechatServer wechatServer = new WechatServer();

        Observer userZhang = new User("ZhangSan");
        Observer userLi = new User("LiSi");
        Observer userWang = new User("WangWu");

        wechatServer.registerObserver(userZhang);
        wechatServer.registerObserver(userLi);
        wechatServer.registerObserver(userWang);
        wechatServer.setInformation("PHP是世界上最好用的语言");

        wechatServer.removeObserver(userZhang);
        wechatServer.setInformation("张三出局");
    }
}
